
require("Controller/BeijingManager");
require("Controller/PlayerManager");
require("Controller/EnemyFactory");
require("Controller/DestroyCollider");
require("View/BattlePanel");
require("View/SettingPanel");

GameRoot = {};
local this = GameRoot;

function GameRoot.OnInitOK()
	
	BeijingManager.New();--加载背景
	DestroyCollider.New();--碰撞检测
	BattlePanel.New();

	resMgr:LoadPrefab("prefabs", {"PlayerBullet", "EnemyBullet"}, this.OnLoadOK);
end

local playerBulletPrefab;
local enemyBulletPrefab;
function GameRoot.OnLoadOK(objs)
	playerBulletPrefab = objs[0];
	enemyBulletPrefab = objs[1];
	--创建对象池
	poolMgr:CreatePool("PlayerBullet", 1, 10, playerBulletPrefab);
	poolMgr:CreatePool("EnemyBullet", 1, 10, enemyBulletPrefab);
	
	
	--加载玩家和敌人
	PlayerManager.New();
	EnemyFactory.New();
end